import { Component, OnInit } from '@angular/core';
import {DashService} from '../dash.service';

export class MemberData {
  today = [];
  yestoady = [];
  week = [];
}
export class AppletData {
  today = [];
  yestoady = [];
  week = [];
}

@Component({
  selector: 'data-dash',
  templateUrl: 'data-dash.component.html',
  styleUrls: ['data-dash.component.scss'],
  providers: [DashService]
})
export class DataDashComponent implements OnInit {

  memberData = new MemberData;
  appletData = new AppletData; // all_num:所有 staus1:未授权 status2:未发布 status3:已发布 status4:已冻结

  constructor(private dashService: DashService) { }

  ngOnInit() {
    this.getAppletData();
    this.getMemberData();
  }

  // 获取小程序统计
  getAppletData() {
    this.dashService.getAppletData().subscribe(
      res => {
        this.appletData = res.data;
      }
    );
  }

  // 获取用户统计
  getMemberData() {
    this.dashService.getMemberData().subscribe(
      res => {
        this.memberData = res.data;
      }
    )
  }
}
